<?php
/**
 * Created by JetBrains PhpStorm.
 * User: leon
 * Date: 11/20/12
 * Time: 7:15 PM
 * To change this template use File | Settings | File Templates.
 */

namespace BWL\webshopBundle\Entity;

use Doctrine\ORM\Mapping as ORM;


/**
 * @ORM\Table(name="ordering")
 * @ORM\Entity(repositoryClass="BWL\webshopBundle\Repository\OrderingRepository")
 */
class Ordering
{

  /**
   * @ORM\Id
   * @ORM\Column(type="integer")

   */
  protected $id;

  /**
   * @ORM\Id
   * @ORM\ManyToOne(targetEntity="User", inversedBy="orderings")
   * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false)
   */
  protected $user;

  /**
   * @ORM\Id
   * @ORM\ManyToOne(targetEntity="Item", inversedBy="orderings")
   * @ORM\JoinColumn(name="item_id", referencedColumnName="id", nullable=false)
   */
  protected $item;

  /**
   * @ORM\Column(type="integer")
   */
  protected $count;

  /**
   * @ORM\Column(type="decimal", scale=2)
   */
  protected $price;

  /**
   * @ORM\Column(type="datetime")
   */
  protected $orderDate;

  /**
   * @ORM\Column(type="datetime", nullable=true)
   */
  protected $shipmentDate;

  /**
   * @ORM\ManyToOne(targetEntity="OrderState", inversedBy="orderings")
   * @ORM\JoinColumn(name="state", referencedColumnName="name", nullable=false)
   */
  protected $state;

  function __construct(){
    $this->setOrderDate(new \DateTime("now"));
    $this->setShipmentDate((new \DateTime('now'))->modify('+1 day'));
  }

  public function setCount($count) {
    $this->count = $count;
  }

  public function getCount() {
    return $this->count;
  }

  public function setId($id) {
    $this->id = $id;
  }

  public function getId() {
    return $this->id;
  }

  public function setItem($item) {
    $this->item = $item;
  }

  public function getItem() {
    return $this->item;
  }

  function setOrderDate($orderDate) {
    $this->orderDate = $orderDate;
  }

  public function getOrderDate() {
    return $this->orderDate;
  }

  public function setPrice($price) {
    $this->price = $price;
  }

  public function getPrice() {
    return $this->price;
  }

  public function setShipmentDate($shipmentDate) {
    $this->shipmentDate = $shipmentDate;
  }

  public function getShipmentDate() {
    return $this->shipmentDate;
  }

  public function setState($state) {
    $this->state = $state;
  }

  public function getState() {
    return $this->state;
  }

  public function setUser($user) {
    $this->user = $user;
  }

  public function getUser() {
    return $this->user;
  }


}
